﻿using jlynet.core.notebook.myform;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace jlynet.core.notebook.util
{
    /// <summary>
    /// 显示包含文本，按钮，图标内的消息对话框
    /// </summary>
    public class MsgBoxHelper
    {
        // 参数为空时的默认值
        private static string defaultCaption = string.Empty;
        private static MsgBoxButtons defaultButtons = MsgBoxButtons.OK;
        private static MsgBoxIcon defaultIcon = MsgBoxIcon.None;
        /// <summary>
        /// 消息对话的结果
        /// </summary>
        internal static MsgBoxDialogResult result = MsgBoxDialogResult.None;
        /// <summary>
        /// 显示可包括文本，符号和按钮的消息框
        /// </summary>
        /// <param name="text">文本</param>
        /// <returns>结果</returns>
        public static MsgBoxDialogResult Show(string text)
        {
            return Show(text, defaultCaption, defaultButtons, defaultIcon);
        }
        /// <summary>
        /// 显示可包括文本，符号和按钮的消息框
        /// </summary>
        /// <param name="text">文本</param>
        /// <param name="caption">标题</param>
        /// <returns>结果</returns>
        public static MsgBoxDialogResult Show(string text, string caption)
        {
            return Show(text, caption, defaultButtons, defaultIcon);
        }

        /// <summary>
        /// 显示可包括文本，符号和按钮的消息框
        /// </summary>
        /// <param name="text">文本</param>
        /// <param name="caption">标题</param>
        /// <param name="buttons">按钮</param>
        /// <returns>结果</returns>
        public static MsgBoxDialogResult Show(string text, string caption, MsgBoxButtons buttons)
        {
            return Show(text, caption, buttons, defaultIcon);
        }
        /// <summary>
        /// 显示可包括文本，符号和按钮的消息框
        /// </summary>
        /// <param name="text">文本</param>
        /// <param name="caption">标题</param>
        /// <param name="buttons">按钮</param>
        /// <param name="icon">图标</param>
        /// <returns>结果</returns>
        public static MsgBoxDialogResult Show(string text, string caption, MsgBoxButtons buttons, MsgBoxIcon icon)
        {
            //初始化消息框
            DialogForm dialogForm = new DialogForm(text, caption, buttons, icon);
            //弹出消息框
            dialogForm.ShowDialog();
            //返回结果
            return result;
        }


    }
}
